Skip to content

Symbol not found: _syslog$DARWIN_EXTSN with version 2.7.6 #807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
maerteijn opened this issue Nov 9, 2018 · 16 comments
Closed

Symbol not found: _syslog$DARWIN_EXTSN with version 2.7.6 #807

maerteijn opened this issue Nov 9, 2018 · 16 comments
Labels
osx wheel Bugs related to the wheel distribution, not happening installing from source

Comments

@maerteijn
Copy link

maerteijn commented Nov 9, 2018

Full stacktrace:

  File "/Users/martijn/.pyenv/versions/3.7.0/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/Users/martijn/.pyenv/versions/3.7.0/envs/my-virtualenv/lib/python3.7/site-packages/django/db/backends/postgresql/base.py", line 24, in <module>
    raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: dlopen(/Users/martijn/.pyenv/versions/3.7.0/envs/my-virtualenv/lib/python3.7/site-packages/psycopg2/_psycopg.cpython-37m-darwin.so, 2): Symbol not found: _syslog$DARWIN_EXTSN
  Referenced from: /Users/martijn/.pyenv/versions/3.7.0/envs/my-virtualenv/lib/python3.7/site-packages/psycopg2/.dylibs/libcrypto.1.0.0.dylib (which was built for Mac OS X 10.13)
  Expected in: /usr/lib/libSystem.B.dylib
 in /Users/martijn/.pyenv/versions/3.7.0/envs/my-virtualenv/lib/python3.7/site-packages/psycopg2/.dylibs/libcrypto.1.0.0.dylib

This does not happen with the binary wheel version 2.7.5.

Installing from source (pip install --no-binary :all: "psycopg2==2.7.6") does not give any problems.

OS: OSX 10.12.6
Python version: 3.7.0
pyenv: 1.2.6

Does this mean Mac OSX Sierra (10.12) is not supported with the binary wheel packages anymore? If this is on purpose, maybe this could be added to the release notes.

@dvarrazzo
Copy link
Member

I don't know if anything changed in the way wheels are built for OSX. I didn't change anything relevant in the build chain.

FYI the Travis jobs which built the packages are this for psycopg2 and this for psycopg2-binary. They were tested but only on the same Travis machine. That's all I can do.

I don't own any OSX machine to play with. If you can suggest a fix that'd be welcome. Thank you very much.

@takeda
Copy link

takeda commented Nov 9, 2018

Got the same error, OSX 10.12.6 as well, but python 2.7.15.

Python 2.7.15 (default, Sep 12 2018, 13:34:35)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/takeda/py27/lib/python2.7/site-packages/psycopg2/__init__.py", line 50, in <module>
    from psycopg2._psycopg import (                     # noqa
ImportError: dlopen(/Users/takeda/py27/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _syslog$DARWIN_EXTSN
  Referenced from: /Users/takeda/py27/lib/python2.7/site-packages/psycopg2/.dylibs/libcrypto.1.0.0.dylib (which was built for Mac OS X 10.13)
  Expected in: /usr/lib/libSystem.B.dylib
 in /Users/takeda/py27/lib/python2.7/site-packages/psycopg2/.dylibs/libcrypto.1.0.0.dylib
>>> ^D

To me it looks like the latest OS X uses newer libcrypto, perhaps when creating the binary version one should make it compile the library statically? From my own experience I remember it is difficult to force compiler on Mac to do it and it only worked when dylib was not present in the path so the compiler failed back to the .a file)

Out of curiosity anyone knows if cffi when used is tied to specific library version or does it use whatever is available? I'm wondering if that could solve this kind of issues once and for all, and as a bonus would make the library operational on pypy.

@rjruizes
Copy link

rjruizes commented Nov 9, 2018

I got the same error; OSX 10.12.6, Python 3.7

    from psycopg2._psycopg import (                     # noqa
ImportError: dlopen(/Users/rr214/.local/share/virtualenvs/postgresDemo-pZMzV3wg/lib/python3.7/site-packages/psycopg2/_psycopg.cpython-37m-darwin.so, 2): Symbol not found: _syslog$DARWIN_EXTSN
  Referenced from: /Users/rr214/.local/share/virtualenvs/postgresDemo-pZMzV3wg/lib/python3.7/site-packages/psycopg2/.dylibs/libcrypto.1.0.0.dylib (which was built for Mac OS X 10.13)

psycopg2 2.7.5 works; 2.7.6 gives the error.

(Temporary workaround pipenv install "psycopg2-binary<=2.7.5")

@dvarrazzo
Copy link
Member

So could the problem be an updated version of crypto on the Travis machines which is not compatible with OSX 10.12? Can it be solved by compiling crypto locally?

@takeda
Copy link

takeda commented Nov 9, 2018

Not sure I understand the question but at least in my and @maerteijn's case looks like everything works fine if psycopg2 is compiled locally i.e. pip install --no-binary :all: psycopg2 installs a working library.

@dvarrazzo
Copy link
Member

@takeda of course: this is a problem with the binary package.

@dvarrazzo dvarrazzo added osx wheel Bugs related to the wheel distribution, not happening installing from source labels Nov 10, 2018
dvarrazzo added a commit that referenced this issue Nov 10, 2018
Test packages to be release to check if #807 is fixed.

According to https://docs.travis-ci.com/user/reference/osx/#os-x-version
we built the packages with OS X 10.13 and Xcode 9.4.1. Because the error
was reported on 10.12, trying to build with Xcode 9.2 (the most recent
available on OSX 10.12).

[skip ci]
dvarrazzo added a commit to psycopg/psycopg2-wheels that referenced this issue Nov 10, 2018
According to https://docs.travis-ci.com/user/reference/osx/#os-x-version
we built the packages with OS X 10.13 and Xcode 9.4.1. Because the error
was reported on 10.12, trying to build with Xcode 9.2 (the most recent
available on OSX 10.12).

See bug psycopg/psycopg2#807.
@dvarrazzo
Copy link
Member

This is the list of supported OSX versions on Travis. 2.7.6 was built using OS X 10.13 and Xcode 9.4.1. I'm building test packages using Xcode 9.2, the last available running on OS X 10.12. However, for a reference, 2.7.5 was built with Xcode 8.3.

@dvarrazzo
Copy link
Member

I've made test packages available on Test PyPI as Psycopg 2.7.6.1.dev1. Please test them using:

pip install -i https://test.pypi.org/simple/ psycopg2==2.7.6.1.dev1

and let me know if they fix the problem. Thank you.

@takeda
Copy link

takeda commented Nov 10, 2018

That version works on my machine.

@maerteijn
Copy link
Author

I can also confirm these test packages work!

dvarrazzo added a commit to psycopg/psycopg2-wheels that referenced this issue Nov 11, 2018
According to https://docs.travis-ci.com/user/reference/osx/#os-x-version
we built the packages with OS X 10.13 and Xcode 9.4.1. Because the error
was reported on 10.12, trying to build with Xcode 9.2 (the most recent
available on OSX 10.12).

See bug psycopg/psycopg2#807.
@dvarrazzo
Copy link
Member

Thank you all for testing. Psycopg binary packages 2.7.6.1 released.

@haeyong27
Copy link

Thank you all for testing. Psycopg binary packages 2.7.6.1 released.

It works for me too. Thanks!

@clrengif
Copy link

clrengif commented Nov 2, 2019

works!! 2019

@bcrant
Copy link

bcrant commented Apr 22, 2020

Saves the day! So glad I found this. Still working in 2020. Installing psycopg2-binary did the trick. Thank you!

@mariuspotor
Copy link

mariuspotor commented Jun 7, 2020

You can also obtain a stand-alone package, not requiring a compiler or external libraries:
pip install psycopg2-binary. This solved the problem.

@Phil999-art
Copy link

Hello, I've tried the above solutions, neither of them work when I try to import the psycopg2 package in IDLE or ATOM. However, when I try to import it within Jupyter, it works. I install the 2.7.6.1 version, then when it didn't work, I reinstalled the 2.8.5 version. Does anyone know why it only works within Jupyter notebooks and not any other editor/IDE? I used the pip installer instead of the conda installer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
osx wheel Bugs related to the wheel distribution, not happening installing from source
Projects
None yet
Development

No branches or pull requests

9 participants